public class Edge{
	private double weight;
	private Vertex u,v; 
	
	Edge() {
		
	}
	
	Edge(Vertex v1, Vertex v2) {
		u = v1;
		v = v2;
	}
	Edge(Vertex v1, Vertex v2, double w) {
		u = v1;
		v = v2;
		setWeight(w);
		
		v1.vecEdges.add(this);
		v2.vecEdges.add(flipEdge(v1, v2, w));
	}
	
	Edge flipEdge(Vertex v1, Vertex v2, double w) {
		Edge temp = new Edge(v2, v1);
		temp.setWeight(w);
		
		return temp;
	}
	
	boolean isVisited() {
		return v.visited;
	}

	public void setWeight(double weight) {
		this.weight = weight;
	}

	public double getWeight() {
		return weight;
	}
	
	public Vertex getV1() {
		return u;
	}
	
	public Vertex getV2() {
		return v;
	}
	
	public boolean hasVertex(Vertex vert) {
		if (vert.getIndex() == v.getIndex())
			return true;
		else 
			return false;
	}
	
	//for debugging purposes
	public void print() {
		//System.out.println("Start vertex: " + u.getIndex() + " End vertex: " + v.getIndex() + " Weight: " + weight);
		System.out.println(u.getIndex() + "\t" + v.getIndex() + "\t" + weight);
	}
}
